#define  _CRT_SECURE_NO_WARNINGS



#include<stdio.h>

int fun(int n)
{
	int count = 0;
	while (n)
	{
		if (n % 10 == 3)
			count++;
		n /= 10;
	}
	return count;
}
int main()
{
	int n = 0, m = 0;
	scanf("%d %d", &n, &m);
	if (n % 19 == 0 && fun(n) == m)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}